import os
from xml.etree import ElementTree as ET

xml_string = "<root><element>Some data</element></root>"
root1 = ET.fromstring(xml_string)
xml_doc = "doc.xml"
with open(xml_doc, "w") as f:
    f.write(xml_string)
tree = ET.parse(xml_doc)
root2 = tree.getroot()
e1 = root1.find("element").text
e2 = root2.findall("element")[0].text
print(e1 == e2)
os.remove(xml_doc)
